package org.test6;

import java.lang.annotation.*;

@Inherited
@Documented
@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)  //源码级别: 注解在声明地方有效
public @interface MyAnnotation {
    //成员,默认情况下是必须的
    public String name() default "abc";
}

class B{
    @MyAnnotation
    public void show(){}
    @MyAnnotation(name = "llll")
    private int age;
}